package cn.com.asd.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.com.asd.service.TbParaService;
import cn.netshop.pojo..TbPara;

/**
 * TbPara的路由接口服务
 * 
 * @author 
 *
 */
@RestController
public class TbParaController {

	/** TbParaService服务 */
	@Autowired
	private TbParaService tbParaService;
	
	/**
	 * 查询所有TbPara数据的方法
	 * @param value
	 * @return
	 */
	@GetMapping(value = "/TbPara", produces = {"application/json;charset=UTF-8"})
	public String find(TbPara value) {
		return tbParaService.find(value);
	}
	
	/**
	 * 通过id查询TbPara数据的方法
	 * @param id
	 * @return
	 */
	@GetMapping(value = "/TbPara/{id}", produces = {"application/json;charset=UTF-8"})
	public String findOne(@PathVariable(name="id") Integer id) {
		return tbParaService.findOne(id);
	}
	
	/**
	 * 插入TbPara属性不为空的数据方法
	 * @param id
	 * @return
	 */
	@PostMapping(value = "/TbPara", produces = {"application/json;charset=UTF-8"})
	public String save(TbPara value) {
		return tbParaService.saveNotNull(value);
	}
	
	/**
	 * 更新TbPara属性不为空的数据方法
	 * @param id
	 * @return
	 */
	@PutMapping(value = "/TbPara", produces = {"application/json;charset=UTF-8"})
	public String update(TbPara value) {
		return tbParaService.updateNotNullById(value);
	}

	/**
	 * 通过id删除TbPara数据方法
	 * @param id
	 * @return
	 */
	@DeleteMapping(value = "/TbPara/{id}", produces = {"application/json;charset=UTF-8"})
	public String delete(@PathVariable(name="id") Integer id) {
		return tbParaService.deleteById(id);
	}
}
